package com.ybfenpan.controller.admin.center;


import java.util.HashMap;
import java.util.Map;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;

import com.ybfenpan.controller.core.BaseController;
import com.ybfenpan.model.Member;
import com.ybfenpan.service.MemberService;
import com.ybfenpan.taglib.pagetag.Pagination;
import com.ybfenpan.utils.MapUtil;








/**
 * Created by Administrator on 2016/3/25.
 */
@Controller

public class CenterListController extends BaseController {

    
	@Resource 
	private MemberService memberService;
   
   
    @RequestMapping("admin/center/centerList.shtml")
    public String list(HttpServletRequest request) throws Exception{
        HashMap formMap = getParameterMap(request); 
       
        formMap.put("where", " 1=1 and a.accountCenter='T'");  
        Pagination page = memberService.queryForPageList("memberForPage",formMap);
        request.setAttribute(Pagination.pageBeanName, page);
        return "admin/center/centerList";
    }

    @RequestMapping("admin/center/centerRemove.shtml")
    public String delete(HttpServletRequest request) throws Exception{
        Map formMap = getParameterMap(request);
        int id = MapUtil.getIntValue(formMap, "id");
        if(id>0){
        	 Member one=this.memberService.getByKey(id);
        	 one.setAccountCenter("F");
        	memberService.update(one);
        }
        return "redirect:centerList.shtml";
       
    }
}
